<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Task,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException,com.ejoysoft.common.exception.IdObjectException" %>
<%@ include file="../include/jsp/head.jsp"%>


<%  
    Task  task0=null;
    Task obj=new Task(globa);
    String strId = ParamUtil.getString(request,"strId","").trim();
    String  strMac=ParamUtil.getString(request,"strMac","").trim();
    String  presenttime=ParamUtil.getString(request,"dtCreatTime","").trim();
    //System.out.println("00000000000000"+strMac+"000000000000000000"+presenttime+"00000000");
    if(presenttime!=null && presenttime.indexOf(".")> 0)
    {
    	presenttime = presenttime.substring(0,presenttime.indexOf("."));
    }
   //System.out.println("00000000000000"+presenttime+"000000000000000000");
	//String where="where strMac='"+strMac+"'";
	//where += " and dtcreattime>='"+starttime+"' ";
	//Task obj0=new Task(globa,false);
    //Task obj2=obj.show(where);
	String Where=" WHERE 1=1";
	if (!strMac.equals("")) {
		Where += " and strMac ='" + strMac+"'";
		Where += " and dtCreatTime < to_date('"+presenttime+"','yyyy-mm-dd hh24:mi:ss')";
	}
	Where += " ORDER BY dtCreatTime";
	System.out.println("strMac:"+strMac);
	System.out.println("Where:"+Where);
   //System.out.println(Where);
	
    
	//记录总数
	int intAllCount=obj.getCount(Where);
	
	//当前页
	int intCurPage=globa.getIntCurPage();
	//每页记录数
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
    int intPageSize;
    if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集
	Vector<Task> vctObj=obj.list(Where,intStartNum,intPageSize);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
	if (intAllCount == 0){
	out.print("<script>alert('此AP没有历史任务');window.history.back(-1);</script>");}
	%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script language="javascript">
 function showAc(){
   document.getElementById('<%=Constants.PAGE_SIZE_INDEX%>').value= "1";
  frm.submit();
 }
</script>
<style>
A {text-decoration: NONE} 
</style>
</head>


<body>
<form name=frm method=post action="task_lookold.jsp"> 
<input id="strMac" name="strMac" type="hidden" value="<%=strMac %>"/>
<input id="dtCreatTime" name="dtCreatTime" type="hidden" value="<%=presenttime %>"/>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">资源配置</font> &gt; 任务列表 &gt; 历史任务  </td>
  </tr>
</table>

 <table width="971" border="0" cellpadding="0" cellspacing="0" height="82">
	<tr><td valign="top"><br /></td><td valign="top"><br /></td><td valign="top"><br /></td><td valign="top"><br /></td><td valign="top"><br /></td></tr><tr><td valign="top"><br /></td><td valign="top"><br /></td><td valign="top"><br /></td><td valign="top"><br /></td><td valign="top"><br /></td></tr><tr>
    <td class="listtit"   style="border-left:1px solid #32a4ea;"><input type="checkbox" name="checkbox" value="checkbox" onclick="selAll(document.all.strId)"  />
    全选</td>
    <td class="listtit" >任务测试内容</td>
    <td class="listtit" >任务描述</td>
    <td class="listtit" >任务创建时间</td>
    <td class="listtit" >基本操作</td>
    </tr>
    <%
            
              for (int i = 0;i < vctObj.size(); i++) {
              //System.out.println("0000000000000"+i+"0000000000000");
              String id = "";
              String name = "";
              String desc="";
              String dtcreattime="";
            	Task obj1 = vctObj.get(i);
            	//int flag=obj1.getDtCreatTime().compareToIgnoreCase(obj2.getDtCreatTime());
            	//System.out.println("000000000000000000"+flag+"0000000000000");
            	if(obj1.getStrId()!=null)id=obj1.getStrId();
            	if(obj1.getStrName()!=null)name=obj1.getStrName();
            	if(obj1.getStrDesc()!=null)desc = obj1.getStrDesc();
            	if(obj1.getDtCreatTime()!=null)dtcreattime = obj1.getDtCreatTime();
            	
            %>
    
    <tr>
    <td class="listd1" style="border-left:1px solid #dddddd;"><input type="checkbox" name="strId" value="<%=obj1.getStrId() %>"  /></td>
    <td class="listd1"><%=name %>&nbsp;</td>
    <td class="listd1"><%=desc %>&nbsp;</td>
    <td class="listd1"><%=dtcreattime%>&nbsp;</td>
    <td class="listdrd" style="border-right:1px solid #dddddd;">  <img src="../images/del.jpg" width="11" height="11" align="absmiddle" /> <a href="#" onclick="if(confirm('确认删除该记录？')){location.href='task_act.jsp?<%=Constants.ACTION_TYPE%>=<%=Constants.DELETE_STR%>&strId=<%=obj1.getStrId()%>';}" >删除</a></td> 
  </tr>
  
           
            
    <%
    }
         
            
            %>
    
    
    </table>
    <table width="971" height="56">
	<tr>
	 <td width="40%"></td>
	 <td>&nbsp; &nbsp;</td>
	
	<td>&nbsp; &nbsp;</td>
	</tr>
	</table>
	
	<table width="971" border="0" align="left" cellpadding="0" cellspacing="0" height="52">
  <tr>
    <td width="50%" height="50" valign="bottom"><!--<img src="../images1/pldel.jpg" width="83" height="27" align="absmiddle" style="cursor:hand"/>--> 页面记录数

        <select name="strPageSize" id="strPageSize"  onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		%>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>  
   		 
      </select>  
    
    </td>		
    <td width="30%" align="right" valign="bottom"><!--<table width="310" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="40"><img src="../images/up.jpg" width="40" height="30" /></td>
        <td width="221" align="center" background="../images/page_bg.jpg" class="page"><a href="#">1</a>&nbsp; <a href="#">2</a>&nbsp; <a href="#">3</a>&nbsp; <a href="#"><span class="sel">4</span></a>&nbsp; <a href="#">5</a> &nbsp;<a href="#">6</a> &nbsp;<a href="#">7</a>&nbsp; <a href="#">8 </a>&nbsp;<a href="#">9</a>&nbsp;...&nbsp;<a href="#">13</a> </td>
        <td width="39"><img src="../images/down.jpg" width="39" height="30" /></td>
      </tr>
    </table>--><!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
       	<td height="50"  align="center" valign="bottom">
	   <input name="B12" type="button"  onclick="window.location.href='task_list.jsp';" value="返 回" class="ipt1" style="cursor:hand"/>
	  </td>
       	
  </tr>
 
</table>


 </form>
</body>
</html>

<%@ include file="../include/jsp/footer.jsp"%>



